package cn.sunlelin.educationserver.controller;

import cn.sunlelin.educationserver.entity.Degree;
import cn.sunlelin.educationserver.service.DegreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@CrossOrigin
public class DegreeController {
    @Autowired
    DegreeService degreeService;

    //Get请求 http://localhost:8089/degree/selectDegreeById/{degreeId}
    @GetMapping("/degree/selectDegreeById/{degreeId}")
    public Map<String,Object> selectDegreeById(@PathVariable Integer degreeId){
        Degree degree=degreeService.selectDegreeById(degreeId);
        Map<String,Object> map=new HashMap<>();
        if(degree!=null){
            map.put("code",200);
            map.put("msg","Id查询学历信息成功");
            map.put("dataobject",degree);
        }
        else {
            map.put("code",500);
            map.put("msg","Id查询学历信息失败");
            map.put("dataobject",null);
        }
        return map;
    }
}
